<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title> mswitch 2.8 - documentation 
</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="EDoc">
</head>
<body bgcolor="white">
<div class="navbar"><a name="#navbar_top"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
<h1> mswitch 2.8 - documentation 
</h1>
<p><b>Authors:</b> Jean-Lou Dupont.</p>
   

<p><b>mswitch</b> consists of a erlang daemon serving inter-node messages through a publish/subscribe API.</p>

<h3><a name="Daemon_management">Daemon management</a></h3>

<p>The mswitch daemon can be managed using the command-line script 'mswitch'.</p>

	<pre>		mswitch start
		mswitch stop</pre>

<h3><a name="API">API</a></h3><p>
The API consists of the following functions:</p>

<ul>
 <li>subscribe(Mailbox, Bus)</li>
 <li>unsubscribe(Bus)</li>
 <li>publish(Bus, Message)</li>
</ul>

<h3><a name="Resiliency">Resiliency</a></h3><p>
The subscription details of each subscriber is kept local to each subscriber. This is transparent to the API user.
When the 'mswitch' daemon restarts, the subscription details of each subscriber is used to automatically re-subscribe each one. </p>

<h3><a name="Usage">Usage</a></h3>

<p>To use the services of mswitch with Erlang, the mswitch library must be installed locally.
This step is normally taken care of when installing from the Debian repository associated with the project.</p>

<h4><a name="Subscribing">Subscribing</a></h4>

<p>To subscribe to a 'bus':</p>

	<pre>		mswitch:subscribe(Mailbox, Bus)</pre>
	where:
	<ul>
	 <li>'Bus' is any valid Erlang term (atom, string)</li>
	 <li>'Mailbox' consists of a tuple {Module, Function, Server} or</li>
	 <li>'Mailbox' consists of an registered atom() for the recipient Server</li> 
	</ul>
	
	<p>The 'Mailbox' is a Module:Function reachable by the Erlang emulator and 'Server' consists of	
a registered server process.</p>
	
<h4><a name="Sending">Sending</a></h4>

<p>To send a Message on a Bus,</p>

	<pre>		mswitch:publish(Bus, Message)</pre><p>	
where 'Message' is any valid Erlang term.</p>
	
<h4><a name="Receiving">Receiving</a></h4>

<p>Subscribers receive Message through their registered server process using a small 'thunk':</p>

	<pre>		inbox({FromNode, Server, Bus, Message}) -&gt;
			Server ! {FromNode, Bus, Message}.</pre>

	When a subscriber wishes to receive messages from 'Bus', a 'Mailbox' of the form:
	<pre>		Mailbox = {Module, inbox, Server}</pre><p>	
can be used.</p>

<h3><a name="Releases">Releases</a></h3>

  <h4><a name="0.1">0.1</a></h4><p>  
Initial release</p>
  
  <h4><a name="0.2">0.2</a></h4>
  <ul>
   <li>Added the default "system" bus.</li>
   <li>Added 'nodes' command to mswitch_control</li>
  </ul>
  
  <h4><a name="0.3">0.3</a></h4>
  <ul>
   <li>Factored-in module hierarchy</li>
   <li>Added 'mswitch_sniffer' command-line utility</li>   
  </ul>
  
  <h4><a name="1.0">1.0</a></h4>
  <ul>
   <li>Changed inbox API to include the source 'bus'</li> 
  </ul>
  
  <h4><a name="1.1">1.1</a></h4>
  <ul>
   <li>Corrected dependencies for control script </li> 
  </ul>
  
  <h4><a name="2.0">2.0</a></h4>
  <ul>
   <li>Improved 'mswitch_sniffer': more monitoring options</li> 
   <li>Added more useful common functions in 'mswitch_tools'</li>
   <li>Added 'mswitch_ctools': helper functions for configuring mswitch apps</li>
  </ul>
  
  <h4><a name="2.3">2.3</a></h4><p>  
Fixed issue with 'url_encode' in mswitch_tools</p>
  
  <h4><a name="2.4">2.4</a></h4><p>  
Fixed init script</p>

  <h4><a name="2.5">2.5</a></h4><p>  
Function "mswitch_ctools:config" now loads default configuration if no configuration is available  
instead of spewing an error.</p>

  <h4><a name="2.6">2.6</a></h4><p>  
Added the 'central inbox' as to simplify subscription for clients. </p>
  
  <h4><a name="2.7">2.7</a></h4><p>  
Fixed 'init.d' script for good (thanks to Stackoverflow community!)</p>

  <h4><a name="2.8">2.8</a></h4>
  Added 'compound types' ('tii', 'tiii', 'taa', 'tai', 'taii') for the configuration tools

<hr>
<div class="navbar"><a name="#navbar_bottom"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
<p><i>Generated by EDoc, Sep 14 2009, 19:59:17.</i></p>
</body>
</html>
